﻿/*
* ==============================================================================
*
* Filename: call_user_binding_util
* Description: call_user_binding_util
*
* Version: 1.0
* Created: 2020/8/31 14:42:48
* Compiler: Visual Studio 2019
*
* Author: Administrator
* Company: freelancer
*
* ==============================================================================
*/

namespace db_util {
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;
	using System.Threading.Tasks;
	using db_model;
	using MySql.Data.MySqlClient;

	public class call_user_binding_util {
		public static call_user_binding_model GetModel(string uuid) {
			var model = new call_user_binding_model();
			string sql = "select id,uuid,b_uid,sipaccount_id from call_user_binding where uuid=?uuid limit 1";
			MySqlParameter[] parameters = {
	 new MySqlParameter("?uuid", MySqlDbType.VarChar,36)
				};
			parameters[0].Value = uuid;
			using (var dr = mysql_helper.GetDataReader(sql, parameters)) {
				if (dr.Read()) {
					model.id = int.Parse(dr["id"].ToString() == "" ? "-1" : dr["id"].ToString());
					model.uuid = dr["uuid"].ToString();
					model.b_uid = dr["b_uid"].ToString();
					model.sipaccount_id = dr["sipaccount_id"].ToString();
				}
			}
			return model;
		}

	}
}